1. Technical Field
The present invention relates to coding and encoding a moving picture.
2. Description of Related Art
Moving picture coding systems compensate for motion using motion vector information. In the case of moving picture coding system that uses multiple reference pictures, reference picture index information as well as motion vector information is required for motion compensation. The reference picture index is a value that is used to distinguish multiple reference pictures from each other. A coder transfers the reference picture index to a decoder. The decoder selects the reference picture as indicated by the reference picture index, and performs motion compensation using the selected reference picture.
Generally, scanning methods for images are classified into either progressive scanning or interlaced scanning. In the case of the progressive scanning, an image of one frame consists of data that are sampled at the same time. In case of the interlaced scanning, an image of one frame consists of data that are sampled at different times, and the samples are alternated line by line.
The interlaced image of a frame is usually divided into two fields called a top field and a bottom field. In the interlaced scanning, one frame is divided into two field images. In this specification, an image is treated based on a unit of a picture. A frame or a field may be referred to as a picture.
Three coding methods for an interlaced moving picture are proposed. A first coding method is a field picture coding method which performs a coding process, considering each field as an independent picture at a picture or slice level. A second coding method is the frame picture coding method which performs a coding process after combining two fields into one frame at a picture or slice level. A third coding method is a frame picture coding method with frame/field macroblock, which performs a coding process by combining two fields into one frame and selecting a frame mode or a field mode at a macroblock level.
In the third coding method, two vertically adjacent macroblocks are bound into a pair and the coding is performed in unit of a macroblock pair. In FIG. 1, numbers assigned in the macroblock pairs indicate macroblock addresses that are used to distinguish the macroblocks from each other.
Here, a frame macroblock is a macroblock which is coded at upper and lower macroblocks of the macroblock pair in units of a frame. In other words, each macroblock is coded in units of a frame after two fields are combined into one frame.
Meanwhile, a field macroblock is a macroblock that is coded at upper and lower macroblocks of macroblock pairs in units of a field. The macroblock pair is divided into top and bottom field components and each field is coded independently. At this time, the macroblock pairs are rearranged so that the upper and lower macroblocks may respectively contain only a top field component and only a bottom field component. The upper macroblock is called a top field macroblock and the lower macroblock is called a bottom field macroblock.
A reference buffer for storing multiple reference pictures is configured in units of a frame. In the frame picture coding, all reference pictures are considered as units of a frame in which two fields are combined into one frame, and one picture among the reference frame pictures is used for motion compensation. Accordingly, values are allocated to the reference picture indexes in units of a frame.
The reference picture index for a P frame is obtained by sorting all the reference frames in an order reverse to a coding order and then sequentially allocating an index, which is increased by one, to the sorted reference frames. The reference picture index for a B frame is classified into a list 0 and a list 1, and is determined based on a display order of the reference frame.
First, in case of the reference frame list 0, indexes are allocated in a reverse order to the reference frames whose display order lags behind the B frame, and then, the remaining indexes are allocated in the display order to the reference frames whose display order leads the B frame. In case of the reference frame list 1, in contrast to the reference frame list 0, indexes are allocated in the display order to the reference frames whose display order leads the B frame, and then, the remaining indexes are allocated in a reverse order to the reference frame whose display order lags behind the B frame. FIG. 2 shows a reference picture index for a P frame when a size of the reference buffer is 5, and FIG. 3 shows the reference picture index lists 0 and 1 for a B frame.
In the field picture coding, the fields of all reference pictures are considered as independent pictures and one of the reference field pictures is used for motion compensation. Accordingly, values are allocated to the reference picture indexes in units of a field. At this time, the reference fields are combined in the unit of a frame, and then, the reference picture indexes in each field of the P frame are sorted in an order reverse to a coding order of the frame. Then, index values that are increased by one are alternately allocated in an order that starts from a reference field having parity equal to a current picture to a reference field having parity different from the current picture, while visiting the sorted reference frames in sequence.
In addition, in the case of the reference picture index lists 0 and 1 for each field of a B frame, all the reference fields are combined in units of a frame and then a reference frame is sorted in the same manner as the method of determining reference frame index of a B frame. Thereafter, the indexes that are increased by one are alternately allocated in an order that starts from a reference field having parity equal to a current picture to a reference field having parity different from the current picture, while visiting the sorted reference frames in sequence.
FIG. 4 shows reference picture indexes of top and bottom fields of a P frame when a size of a reference buffer is 5, and FIG. 5 shows reference picture index lists 0 and 1 of top and bottom fields of a B frame that can be used as a reference.
In order to improve coding efficiency, the moving picture coding system using multiple reference pictures provides a function of reordering the reference picture indexes before decoding a picture or a slice. The reference picture indexes are arbitrarily reordered so as to enhance the coding efficiency after determining an initial reference picture index for the frame and field pictures. FIG. 6 shows a result of determining an initial reference picture index for a P frame and arbitrarily reordering indexes according to the above-described method.
When the moving picture coding system using the multiple reference pictures codes an interlaced moving picture into a frame picture having frame/field macroblocks, all the reference pictures for the frame macroblock are considered as a frame unit and one of the reference frame pictures must be used for motion compensation. In addition, all the reference pictures for the field macroblock are considered as independent pictures and one of the reference field pictures must be used for motion compensation.
Accordingly, in the frame picture coding that selects the frame/field coding modes at the macroblock level, it is necessary to allocate values to the reference picture index in frame unit or field unit according to the coding mode of each macroblock.